cmake_minimum_required(VERSION 3.15)

project(DealBox LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(APPLE)
find_package(yyjson CONFIG REQUIRED PATHS "~/vcpkg/installed/x64-osx/share/yyjson")
find_package(glfw3 CONFIG REQUIRED PATHS "~/vcpkg/installed/x64-osx/share/glfw3")
find_package(CURL REQUIRED)
elseif(UNIX)
find_package(glfw3 CONFIG REQUIRED PATHS "~/vcpkg/installed/x64-linux/share/glfw3")
elseif(WIN32)
set(ZLIB_LIBRARY "D:/VS/Community/VC/vcpkg/installed/x64-windows/lib/zlib.lib")
set(ZLIB_INCLUDE_DIR "D:/VS/Community/VC/vcpkg/installed/x64-windows/include")
set(CMAKE_TOOLCHAIN_FILE "D:/VS/Community/VC/vcpkg/scripts/buildsystems/vcpkg.cmake")
find_package(glfw3 CONFIG REQUIRED PATHS "D:/VS/Community/VC/vcpkg/installed/x64-windows/share/glfw3")
find_package(yyjson CONFIG REQUIRED PATHS "D:/VS/Community/VC/vcpkg/installed/x64-windows/share/yyjson")
find_package(ZLIB REQUIRED)
find_package(CURL CONFIG REQUIRED PATHS "D:/VS/Community/VC/vcpkg/installed/x64-windows/share/curl")
endif()

find_package(OpenGL REQUIRED)
# find_package(Vulkan REQUIRED)

# 包含头文件目录
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/third/include)

if(1)
# 添加子目录
add_subdirectory(${PROJECT_SOURCE_DIR}/third/src)

add_executable(${PROJECT_NAME}
    src/Application.cpp
    src/Finviz.cpp
    src/CandlestickChart.cpp
    src/Widget.cpp
    src/DealBox.cpp
    src/Main.cpp
)
# 链接库
target_link_libraries(${PROJECT_NAME}
    PRIVATE
    imgui
    # implot
    # ZLIB::ZLIB
    CURL::libcurl
    yyjson::yyjson
)
else()
add_subdirectory(${PROJECT_SOURCE_DIR}/test)

endif()

